home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-11-19 | 1.6 KB | 47 lines | [TEXT/MPS ] |
- /*
- File: TMethodNotifierExample.cp
-
- Contains: This module is a very simple example of how to use a TMethodNotifer
-
- Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
-
- */
-
- #include "TInitSLM.h" // the TInitSLM class and SLM include files
- #include "TMethodNotifierExample.h"
-
-
- /*————————————————————————————————————————————————————————————————————————————————————
- main
-
- Simple program to demonstrate the use of a TMethodNotifer. It simply creates
- an instance of TMethodNotifer and sets it's notify routine to a method of
- an instance of TNotifyHandler. We invoke the notify routine by calling the
- TMethodNotifer::Notify method. The notify routine displays its parameters.
- Normally you will give your TMethodNotifer to someone else who is then
- responsible for calling the Notify method at the appropriate time, but in
- this example we call Notify ourself to keep things simple.
- ————————————————————————————————————————————————————————————————————————————————————*/
-
- main()
- {
- TInitSLM initLibraryManager; // initialize the shared library manager
-
- if( initLibraryManager.Failed() ) // If we failed, let's go home
- return 1;
-
- // create an instance of the class that has the notify method.
- TNotifyHandler myhandler;
-
- // allocate TMethodNotifier, and initialize it with the notify method. Then
- // simply call the notify method indirectly, passing information to it.
-
- TMethodNotifier mynotifier( &myhandler, (NotifyMethodPtr)&TNotifyHandler::MyNotifyMethod);
-
- // invoke the notify routine, and passing it evtCode, err, and data
-
- mynotifier.Notify( 123, 456, (void *)6789 );
-
- return 0;
- }
-